package stream;

import pojo.UserInfo;

import java.util.ArrayList;

/**
 * Peek相当于日志操作
 */
public class Peek {
    public static void main(String[] args) {
        ArrayList<UserInfo> list = new ArrayList();
        list.add(new UserInfo(1, "张三", 1));
        list.add(new UserInfo(2, "李四", 2));
        list.add(new UserInfo(3, "王五", 3));
        list.add(new UserInfo(3, "赵六", 4));
        Integer integer = list.stream()
                .distinct()
                .map(UserInfo::getId)
                // 如果List集合直接是int可直接用 .max(Integer::compare)
                .max(Integer::compare)
                .get();
        System.out.println(integer);
    }
}
